package paidaxing.blog.post.service.impl;

import org.springframework.stereotype.Service;
import paidaxing.blog.core.service.PostInfoService;
import paidaxing.blog.post.dto.PostDTO;
import paidaxing.blog.post.service.PostsService;

import jakarta.annotation.Resource;

/**
 * 文章信息服务实现类
 * 实现core模块定义的PostInfoService接口
 */
@Service("postInfoService")
public class PostInfoServiceImpl implements PostInfoService {
    
    @Resource
private PostsService postsService;

    @Override
    public PostInfoDTO getPostInfoById(Long postId) {
        PostDTO postDTO = postsService.getPostDetail(postId);
        if (postDTO == null) {
            return null;
        }
        
        PostInfoDTO postInfoDTO = new PostInfoDTO();
        postInfoDTO.setId(postDTO.getId());
        postInfoDTO.setTitle(postDTO.getTitle());
        postInfoDTO.setContent(postDTO.getContent());
        return postInfoDTO;
    }
}